<template>
  <div
    class="form-check form-check-radio"
    :class="[inlineClass, { diabled: disabled }]"
  >
    <label :for="cbId" class="form-check-label">
      <input
        :id="cbId"
        class="form-check-input"
        type="radio"
        :disabled="disabled"
        :value="name"
        v-model="model"
      />
      <slot></slot>
      <span class="form-check-sign"></span>
    </label>
  </div>
</template>
<script>
export default {
  name: "base-radio",
  props: {
    name: [String, Number],
    disabled: Boolean,
    value: [String, Boolean],
    inline: Boolean,
  },
  data() {
    return {
      cbId: "",
    };
  },
  computed: {
    model: {
      get() {
        return this.value;
      },
      set(value) {
        this.$emit("input", value);
      },
    },
    inlineClass() {
      if (this.inline) {
        return `form-check-inline`;
      }
      return "";
    },
  },
  created() {
    this.cbId = Math.random().toString(16).slice(2);
  },
};
</script>
<style scoped>
.form-check {
  display: flex;
  align-items: center;
  margin: 20px 0; /* 增加上下间距 */
}

.form-check-label {
  font-size: 18px; /* 增加字体大小 */
  font-weight: 400; /* 加粗 */
  color: #333; /* 深色字体提升可读性 */
  font-family: "Poppins", Arial, sans-serif; /* 设置更美观的字体 */
}

.form-check-input {
  width: 20px; /* 调整单选按钮大小 */
  height: 20px;
  margin-right: 8px; /* 增加按钮和文字的间距 */
}


</style>

